<?php
error_reporting( E_ALL );
define('ADMIN_ROOT', dirname(__FILE__));
define('ADMIN_ROOT_CLASS', ADMIN_ROOT . '/class' );
define('ADMIN_ROOT_LIB', ADMIN_ROOT . '/libs' );
define('ADMIN_DOMAIN', 'www.0769-120.com/admin' );

/* for template */
define('TPL_TEMPLATE_DIR', ADMIN_ROOT . '/template' );
define('TPL_COMPILED_DIR', ADMIN_ROOT . '/compiled' );

/* for database*/
define('DBHOST', 'localhost:/opt/mysql/run/mysql.sock');
define('DBUSER', 'root');
define('DBPWD', 'mysqldontsay');
define('DBNAME', 'guide');

/* for class auto load */
function __autoload($class_name)
{
	$file_name = trim(str_replace('_', '/',$class_name), '/') . '.class.php' ;

	//search class_path
	$file_path = ADMIN_ROOT_CLASS . '/' . $file_name ;
	if ( file_exists( $file_path ) )
	{
		return require_once( $file_path );
	}

	throw new Exception( "Can't load class $class_name" );
}

header( 'ContentType: text/html; charset=UTF-8;' );
Session::Init( ADMIN_DOMAIN );
?>
